<template>
    <div>
        <div class="container">
            <div class="nav">
                <div>
                    <!-- <router-link to="/" tag="a"></router-link> -->
                    <a href="javascript:;" @click="$router.back()"></a>
                </div>
                <div>
                    <span>询低价</span>
                </div>
                <div @click="subnav = !subnav">
                    <i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</i>
                    <div class="subnav" v-show="subnav">
                        <router-link to="/" tag="a">首页</router-link>
                        <router-link to="/news" tag="a">资讯</router-link>
                        <router-link to="/video" tag="a">视频</router-link>
                        <router-link to="/seek" tag="a">找车</router-link>
                        <router-link to="/plaint" tag="a">汽车投诉</router-link>
                    </div>
                </div>
            </div>
            <div class="carType">
                <div class="img">
                    <img :src="carImg" alt="">
                </div>
                <div class="info">
                    <h2>{{ carName }}</h2>
                    <span>{{ carName }}</span>
                </div>
            </div>
            <div class="form">
                <ul>
                    <li>
                        <label for="username">您的姓名：</label>
                        <input type="text" id="username">
                    </li>
                    <li>
                        <label for="userphone">您的手机：</label>
                        <input type="text" id="userphone">
                    </li>
                    
                    <li @click="$toast('最低价已发送至您的手机')">询最低价</li>
                </ul>
            </div>
            <div>
                <img src="../assets/img/tg_guide2.gif" alt="">
            </div>
            <div class="search_foot">
                <div></div>
            </div>
        </div>
    </div>
</template>

<script>
import { getJsonCarList } from "../api/carlist"
    export default {
        created() {
            this.$emit("car-show", true);
            this.fun()
        },
        data(){
            return {
                subnav: false,
                toId: "dazhong",
                allData: null,
                index: 0,
                carId: 0,
                carName:"",
                carImg:""
            }
        },
        methods:{
            fun() {
           
                this.carName = this.$route.query.name;
                this.carImg = this.$route.query.img;
                console.log(this.index, "+", this.carId);
                getJsonCarList().then(data => {
                    console.log(data);
                    // this.allData = data[this.toId].type[this.index].prop[this.carId]
                })
                console.log(this.carImg);
            }
        }
    }
</script>

<style lang="scss" scoped>
.nav {
    height: 44px;
    background-color: #35447b;
    display: flex;
    align-items: center;

    &>div {
        &:nth-child(1) {
            text-align: left;
            flex: 1;
        }

        &:nth-child(2) {
            text-align: center;
            flex: 1;
        }

        &:nth-child(3) {
            text-align: right;
            flex: 1;
            padding-right: 10px;
            position: relative;
            i {
                display: block;
                float: right;

            }
            .subnav {
                width: 100px;
                height: 170px;
                padding: 6px;
                border-radius: 4px;
                position: absolute;
                top: 35px;
                left: 12px;
                background: rgba(0, 0, 0, 0.8);
                z-index: 9;

                a {
                    width: 100px;
                    height: 18px;
                    padding: 8px 0;
                    text-align: center;
                    background-image: none;
                    color: #fff;
                }

                &::before {
                    content: "";
                    display: block;
                    position: absolute;
                    top: -17px;
                    left: 80px;
                    border-color: transparent transparent rgba(0, 0, 0, 0.8) transparent;
                    border-width: 9px;
                    border-style: dashed dashed solid dashed;
                }
            }
        }
    }

    div {
        a {
            display: block;
            width: 40px;
            height: 40px;
            background-image: url("../assets/img/icons1.png");
            background-position: -82px -32px;
            background-size: 400px auto;
        }

        span {
            color: #fff;
            font-size: 18px;
        }

        i {
            width: 25px;
            height: 22px;
            background-image: url("../assets/img/icons1.png");
            background-position: -175px -42px;
            background-size: 400px auto;
        }
    }
}
.carType{
    height: 114px;
    padding: 15px 10px;
    display: flex;
    .img{
        border: 1px solid #e5e5e5;
        margin-right: 10px;
        img{
            width: 120px;
            height: 80px;
        }
    }
    .info{
        h2{
            height: 38px;
            padding: 5px 0;
            font-size: 16px;
        }
        span{
            font-size: 14px;
            color: #999;
        }
    }
}
.form{
    height: 144px;
    padding: 0 10px;
    ul{
        li{
            display: flex;
            padding: 2px 0;
            margin-bottom: 12px;
            align-items: center;
            label{
                flex:1;
                text-align: center;
            }
            input{
                flex:3;
                border: 2px solid #e5e5e5;
                height: 28px;
                padding-left: 5px;
                &:focus{
                    border: 2px solid #000;
                    border-radius: 5px;
                }
            }
            &:last-of-type{
                background-color: #f60;
                color: #fff;
                font: 16px;
                border-radius: 5px;
                height: 32px;
                justify-content: center;
            }
        }
    }
}
</style>